const path = require("path");
const HtmlWebpackPlugin = require('html-webpack-plugin')

module.exports = {
  entry: "./src/index.js",
  output: {
    filename: "bundle.js",
    path: path.resolve(__dirname, "./dist"), //path必须是绝对路径
    clean:true//清除无关的文件
  },
  mode: "development",//"development" | "production" | "none"
  plugins: [new HtmlWebpackPlugin({
    template:'./index.html',
    filename:'my-webpack.html',
    inject:'body'//script标签插入的位置
  })],
  devtool:'inline-source-map',//输出的代码格式与开发环境一致
  devServer:{
    static:'./dist'//使用webpack-dev-server(还自带热更新效果)时以该文件目录作为根目录
  }
};
